﻿using System.Web.Routing;

namespace Rosieks.Web.Flow
{
    public class GoToCurrentPolicy : ICheckStatePolicy
    {
        public bool IsCurrentStateValid(WebflowContext webflowContext, RequestContext requestContext, out RouteData routeData)
        {
            routeData = null;

            if (!webflowContext.CurrentState.IsRequestedStep(requestContext))
            {
                routeData = webflowContext.CurrentState.RouteData;

                return false;
            }

            return true;
        }
    }
}
